<template>
  <el-table :data="messages" style="width: 100%">
    <el-table-column label="发送人" prop="sender"></el-table-column>
    <el-table-column label="接收人" prop="receiver"></el-table-column>
    <el-table-column label="内容" prop="content"></el-table-column>
    <el-table-column label="创建时间" prop="createTime"></el-table-column>
    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button size="mini" type="danger" @click="deleteMessage(scope.row.id)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "MessageList",
  props: {
    messages: Array,
  },
  methods: {
    deleteMessage(id) {
      this.$emit("delete", id);
    },
  },
};
</script>